function X = Struct2im(x)
% X = Struct2im(x)
% 
% Struct2im converts an image which is given as a struct to a [M N K]
% image where the image is of size [M N] and has K channels.
%
% See also: Im2struct, Struct2vec, Vec2struct
%
% 2013-07-25 --------------------------------------------------------------
% 
% Matthias J. Ehrhardt
% CMIC, University College London, UK
% 
% matthias.ehrhardt.11@ucl.ac.uk
% 
% -------------------------------------------------------------------------
    
    K = length(x);    
    X = zeros([size(x{1}) K]);
    
    for k = 1 : K
        X(:,:,k) = x{k};
    end
end

